<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="./axios.js"></script>
  <script>
    axios.defaults.baseURL = 'http://www.itcbc.com:3006'
    // 1 得到Promise对象 
    // axios这个函数，和自己封装的函数 差不多。调用 axios 函数，会得到 Promise对象
    let p1 = axios.get('/api/province')
    let p2 = axios.get('/api/city', { params: { pname: '河北省' } })
    let p3 = axios.get('/api/county', { params: { pname: '河北省', cname: '承德市' } })

    let p4 = new Promise((resolve, reject) => {
      resolve(123)
    })

    let p5 = Promise.all([p1, p2, p3])

    async function fn() {
      return 456
    }
    let p6 = fn()

    // 2 获取结果
    async function abc() {
      let res1 = await p1
      let res2 = await p2
      let res3 = await p3
      let res4 = await p4
      let res5 = await p5
      let res6 = await p6
      console.log(res1)
      console.log(res2)
      console.log(res3)
      console.log(res4)
      console.log(res5)
      console.log(res6)
    }
    abc()
    </script>
</body>
</html>